package cn.xiaohuodui.dao;

import cn.xiaohuodui.model.Push;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface PushMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Push record);

    int insertSelective(Push record);

    Push selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Push record);

    int updateByPrimaryKey(Push record);


    /**
     * 查询用户的所有终端的推送token
     *
     * @param uid
     * @return
     */
    List<Push> selectByUid(@Param("uid") int uid);

    /**
     * 删除 用户在 ${platform}下的 推送token
     *
     * @param uid
     * @param platform
     * @return
     */
    int deletePushByPlatformAndUid(@Param("uid") int uid, @Param("platform") int platform);

    /**
     * 获取用户 在 ${platform}下的推送token
     *
     * @param uid
     * @param platform
     * @return
     */
    Push selectByPlatformAndUid(@Param("uid") int uid, @Param("platform") int platform);

    /**
     * 查找用户 的 ${token} 记录
     *
     * @param uid
     * @param token
     * @return
     */
    Push selectByUidAndToken(@Param("uid") int uid, @Param("token") String token);
}